<!DOCTYPE html>
<html class="x-admin-sm">

<head>
    <meta charset="UTF-8">
    <title>欢迎页面-X-admin2.2</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi"/>
    <link rel="stylesheet" href="../css/font.css">
    <link rel="stylesheet" href="../css/xadmin.css">
    <script src="../lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="../js/xadmin.js"></script>
    <style>
        span {
            line-height: 38px;
        }

        .layui-input-block {
            margin-left: 110px;
        }

        .layui-col-space15 > * {
            padding: 0 7.5px 0 7.5px;
        }

        .HexL {
            padding-top: 7.5px;
        }

        .layui-form-label {
            width: 100px;
            padding: 9px 10px !important;
        }

        td {
            width: 52% !important;
        }

        .layui-form-item {
            font-size: 13px;
        }

        .ziliao .layui-form-label {
            float: none;
            font-size: 14px;
        }

        .ziliao .layui-input-block {
            margin-left: -80px;
            padding-right: 30px;
        }

        .layui-input-block img {
            width: 121px;
            height: 121px;
            margin: 5px;
            cursor: pointer;
        }
    </style>
</head>

<body>
<div class="layui-fluid">
    <!--用户个人信息-->
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12 HexL">
            <div class="layui-card">
                <div class="layui-card-body ">
                    <fieldset class="layui-elem-field layui-field-title" style="margin-top: 10px;">
                        <legend>登录信息</legend>
                        <br/><br/>
                        <div style="border:0px solid #F00;margin:0 10% 0;">

                            <form class="layui-form" action="" method="post" id="findAdmin">

                                <table>
                                    <tr>
                                        <td width="70%">
                                            <div class="layui-form-item">
                                                <label class="layui-form-label">姓名 ：</label>
                                                <div class="layui-input-block">
                                                    <span>......</span>
                                                </div>
                                            </div>
                                        </td>

                                        <td>
                                            <div class="layui-form-item">
                                                <label class="layui-form-label">账号 ：</label>
                                                <div class="layui-input-block">
                                                    <span>......</span>
                                                </div>
                                            </div>
                                        </td>
                                    </tr>

                                    <tr>
                                        <td>
                                            <div class="layui-form-item">
                                                <label class="layui-form-label">性别 ：</label>
                                                <div class="layui-input-block">
                                                    <span>......</span>
                                                </div>
                                            </div>
                                        </td>


                                        <td>
                                            <div class="layui-form-item">
                                                <label class="layui-form-label">权限 ：</label>
                                                <div class="layui-input-block">
                                                    <span>......</span>
                                                </div>
                                            </div>
                                        <td>
                                    </tr>

                                    <tr>

                                        <td>
                                            <div class="layui-form-item">
                                                <label class="layui-form-label">状态 ：</label>
                                                <div class="layui-input-block">
                                                    <span>......</span>
                                                </div>
                                            </div>
                                        </td>
                                        <td>
                                            <div class="layui-form-item">
                                                <label class="layui-form-label">注册时间 ：</label>
                                                <div class="layui-input-block">
                                                    <span>......</span>
                                                </div>
                                            </div>
                                        </td>
                                    </tr>
                                </table>
                            </form>
                        </div>
                    </fieldset>
                </div>
            </div>
        </div>
    </div>

    <div  style="float: right;margin-top: 10px" id="modifyDate">
        修改时间 ：<span>......</span>
    </div>
    <script src="http://mat1.gtimg.com/libs/jquery2/2.2.0/jquery.js"></script>

</div>
</body>

</html>
<script src="../js/common/ajaxcommon.js"></script>
<script>
    //获取url中的值
    function getParams(id){
        var reg = new RegExp("(^|&)" + id + "=([^&]*)(&|$)");
        var r = window.location.search.substr(1).match(reg);
        if(r!=null){
            return unescape(r[2]);
        }
        return null;
    }
    var id = getParams("id"); //将获取的url的值赋值给变量id，

   if (id!=null){    //管理员查看信息
       requestAjax("/background/administrator/getIdFindAdministrator",{id:id},function (data) {
           dataRrendering(data);
       })
   } else {             //登录人员信息
       //拿到浏览器存入的cookie
       var token=getCookie("token");
       //获取到登录信息，并进行数据渲染
       requestAjax("/background/login/getLoginInfo",{token:token},function (data) {
           dataRrendering(data)
       });
   }


    /**
     * 数据渲染
     * @param data
     */
    function dataRrendering(data) {
    var role;
    var $findAdmin= $("#findAdmin").find("span");
    if (data.data.role===0){
        role="超级管理员"
    } else  if (data.data.role===1){
        role="业务员"
    }else  if (data.data.role===2){
        role="风控员"
    }else  if (data.data.role===3){
        role="财务员"
    }
    $findAdmin.eq(0).text(data.data.name);
    $findAdmin.eq(1).text(data.data.account);
    $findAdmin.eq(2).text((data.data.gender===1)?'男':'女');
    $findAdmin.eq(3).text(role);
    $findAdmin.eq(4).text((data.data.status===1)?'正常使用':'禁用');
    $findAdmin.eq(5).text(renderTime(data.data.registerDate));
    //注册时间的判断
    if (data.data.modifyDate!=null)
        $("#modifyDate").find("span").text(renderTime(data.data.modifyDate))
    else
        $("#modifyDate").attr("style","display: none");
}
    
    
</script>